<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>厦门美食 - 海上花园城市</title>
    <link rel="stylesheet" href="styles.css">
    <script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=4ETBZ-QOSWL-NZHPN-E7QOL-LNWGQ-T4F6G&callback=initTMapAPI"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', 'SF Pro Display', sans-serif;
            background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
            min-height: 100vh;
            color: #333;
        }

        .navbar {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            padding: 1rem 2rem;
            box-shadow: 0 2px 20px rgba(0,0,0,0.1);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .nav-container {
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .nav-brand {
            font-size: 1.5rem;
            font-weight: bold;
            color: #ff6b6b;
        }

        .nav-menu {
            display: flex;
            list-style: none;
            gap: 2rem;
            align-items: center;
        }

        .nav-menu a {
            color: #333;
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 8px;
            transition: all 0.3s ease;
        }

        .nav-menu a:hover {
            background: rgba(255, 107, 107, 0.1);
            color: #ff6b6b;
        }

        .hero-section {
            text-align: center;
            padding: 4rem 2rem;
            background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(78, 205, 196, 0.1));
            margin-bottom: 3rem;
        }

        .hero-content h1 {
            font-size: 3rem;
            margin-bottom: 1rem;
            background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .hero-content p {
            font-size: 1.3rem;
            color: #666;
            max-width: 600px;
            margin: 0 auto;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 2rem;
        }

        .food-categories {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
            margin-bottom: 3rem;
        }

        .category-section {
            background: rgba(255, 255, 255, 0.9);
            border-radius: 20px;
            padding: 2rem;
            box-shadow: 0 8px 30px rgba(0,0,0,0.1);
            backdrop-filter: blur(10px);
        }

        .category-title {
            font-size: 1.8rem;
            margin-bottom: 1.5rem;
            text-align: center;
            color: #ff6b6b;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
        }

        .food-grid {
            display: grid;
            gap: 1.5rem;
        }

        .food-card {
            background: #fff;
            border-radius: 15px;
            padding: 1.5rem;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
            transition: all 0.3s ease;
            border-left: 4px solid #ff6b6b;
            cursor: pointer;
        }

        .food-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.15);
        }

        .food-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 1rem;
        }

        .food-name {
            font-size: 1.3rem;
            font-weight: bold;
            color: #333;
            margin-bottom: 0.5rem;
        }

        .food-price {
            background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
            color: white;
            padding: 0.3rem 0.8rem;
            border-radius: 20px;
            font-size: 0.9rem;
            font-weight: bold;
        }

        .food-description {
            color: #666;
            line-height: 1.6;
            margin-bottom: 1rem;
        }

        .food-details {
            display: grid;
            gap: 0.5rem;
        }

        .detail-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.9rem;
            color: #555;
        }

        .detail-icon {
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .restaurant-info {
            background: rgba(78, 205, 196, 0.1);
            padding: 1rem;
            border-radius: 10px;
            margin-top: 1rem;
        }

        .restaurant-name {
            font-weight: bold;
            color: #4ecdc4;
            margin-bottom: 0.5rem;
        }

        .opening-hours {
            background: rgba(255, 193, 7, 0.1);
            padding: 0.5rem;
            border-radius: 8px;
            margin-top: 0.5rem;
            font-size: 0.9rem;
        }

        .location-btn {
            background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
            color: white;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 20px;
            font-size: 0.9rem;
            cursor: pointer;
            margin-top: 0.5rem;
            transition: all 0.3s ease;
        }

        .location-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
        }

        /* 地图弹窗样式 */
        .map-modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(5px);
        }

        .map-modal-content {
            background-color: white;
            margin: 3% auto;
            border-radius: 20px;
            width: 85%;
            max-width: 1000px;
            height: 85%;
            max-height: 750px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            animation: modalSlideIn 0.3s ease-out;
        }

        @keyframes modalSlideIn {
            from {
                opacity: 0;
                transform: translateY(-50px) scale(0.9);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .map-header {
            background: linear-gradient(135deg, #ff6b6b, #ee5a52);
            color: white;
            padding: 1.5rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-radius: 20px 20px 0 0;
        }

        .map-title {
            display: flex;
            align-items: center;
            gap: 0.8rem;
            font-size: 1.3rem;
            font-weight: bold;
        }

        .map-title span {
            font-size: 1.5rem;
        }

        .close-btn {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            font-size: 1.8rem;
            width: 45px;
            height: 45px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }

        .close-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }

        .map-container {
            flex: 1;
            position: relative;
            background: #f8f9fa;
        }

        .map-footer {
            background: white;
            padding: 1.8rem 2rem;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1.5rem;
            border-radius: 0 0 20px 20px;
        }

        .restaurant-details h4 {
            color: #ff6b6b;
            margin: 0 0 0.8rem 0;
            font-size: 1.3rem;
            font-weight: bold;
        }

        .restaurant-details p {
            margin: 0.5rem 0;
            color: #666;
            font-size: 1rem;
            line-height: 1.5;
        }

        .navigation-btn {
            background: linear-gradient(135deg, #ff6b6b, #ee5a52);
            color: white;
            border: none;
            padding: 1rem 2rem;
            border-radius: 30px;
            cursor: pointer;
            font-size: 1rem;
            font-weight: bold;
            box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
            transition: all 0.3s ease;
            white-space: nowrap;
        }

        .navigation-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 35px rgba(255, 107, 107, 0.4);
        }

        .food-tips {
            background: rgba(255, 255, 255, 0.9);
            border-radius: 20px;
            padding: 2rem;
            margin: 3rem 0;
            box-shadow: 0 8px 30px rgba(0,0,0,0.1);
        }

        .tips-title {
            font-size: 1.5rem;
            color: #ff6b6b;
            margin-bottom: 1rem;
            text-align: center;
        }

        .tips-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1.5rem;
        }

        .tip-card {
            background: #fff;
            padding: 1.5rem;
            border-radius: 15px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        }

        .tip-card h4 {
            color: #4ecdc4;
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .tip-list {
            list-style: none;
            padding: 0;
        }

        .tip-list li {
            padding: 0.3rem 0;
            color: #666;
            position: relative;
            padding-left: 1.5rem;
        }

        .tip-list li:before {
            content: "•";
            color: #ff6b6b;
            font-weight: bold;
            position: absolute;
            left: 0;
        }

        .back-button {
            display: inline-block;
            background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
            color: white;
            padding: 1rem 2rem;
            border-radius: 25px;
            text-decoration: none;
            margin: 2rem 0;
            transition: all 0.3s ease;
            font-weight: bold;
        }

        .back-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.2);
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .hero-content h1 {
                font-size: 2rem;
            }
            
            .food-categories {
                grid-template-columns: 1fr;
            }
            
            .nav-menu {
                display: none;
            }
            
            .container {
                padding: 0 1rem;
            }

            .map-modal-content {
                margin: 5% auto;
                width: 95%;
                height: 80%;
                max-height: 650px;
            }

            .map-header {
                padding: 1.2rem 1.5rem;
            }
            
            .map-title {
                font-size: 1.1rem;
            }
            
            .map-footer {
                padding: 1.5rem;
                flex-direction: column;
                gap: 1rem;
                text-align: center;
            }
            
            .restaurant-details h4 {
                font-size: 1.2rem;
            }
            
            .restaurant-details p {
                font-size: 0.9rem;
            }
            
            .navigation-btn {
                padding: 0.8rem 1.5rem;
                font-size: 0.9rem;
                width: 100%;
            }
        }

        @media (max-width: 480px) {
            .map-modal-content {
                margin: 8% auto;
                width: 98%;
                height: 75%;
                max-height: 600px;
            }
            
            .map-header {
                padding: 1rem;
            }
            
            .map-title {
                font-size: 1rem;
            }
            
            .close-btn {
                width: 40px;
                height: 40px;
                font-size: 1.5rem;
            }
            
            .map-footer {
                padding: 1.2rem;
            }
        }
    </style>
</head>
<body>
    <nav class="navbar">
        <div class="nav-container">
            <div class="nav-brand">鹭行记</div>
            <ul class="nav-menu">
                <li><a href="index.html">🏠 首页</a></li>
                <li><a href="explore.html">🔍 探索</a></li>
                <li><a href="#snacks">小吃</a></li>
                <li><a href="#seafood">海鲜</a></li>
                <li><a href="#desserts">甜品</a></li>
                <li><a href="#tips">美食攻略</a></li>
            </ul>
        </div>
    </nav>

    <section class="hero-section">
        <div class="hero-content">
            <h1>🍜 厦门美食天堂</h1>
            <p>品味闽南风情，探索海上花园的舌尖美味</p>
        </div>
    </section>

    <div class="container">
        <div class="food-categories">
            <div class="category-section" id="snacks">
                <h2 class="category-title">🥟 经典小吃</h2>
                <div class="food-grid">
                    <div class="food-card" onclick="showMap('四里沙茶面', '思明区大同路49号', 24.4478, 118.0832, '06:30-14:00, 17:00-02:00', '沙茶面')">
                        <div class="food-header">
                            <div class="food-name">沙茶面</div>
                            <div class="food-price">15-25元</div>
                        </div>
                        <div class="food-description">
                            厦门最具代表性的面食，浓郁的沙茶汤底配上Q弹面条，加入虾仁、鱿鱼、豆腐等丰富配菜，香味浓郁，回味无穷。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：四里沙茶面</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区大同路49号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：06:30-14:00, 17:00-02:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('四里沙茶面', '思明区大同路49号', 24.4478, 118.0832, '06:30-14:00, 17:00-02:00', '沙茶面')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('西门土笋冻', '思明区大同路136号', 24.4485, 118.0825, '07:00-22:00', '土笋冻')">
                        <div class="food-header">
                            <div class="food-name">土笋冻</div>
                            <div class="food-price">8-15元</div>
                        </div>
                        <div class="food-description">
                            闽南特色小吃，用海边的土笋虫制作，晶莹剔透，口感Q弹，蘸上蒜蓉、酱油、辣椒油，鲜美无比。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：西门土笋冻</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区大同路136号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：07:00-22:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('西门土笋冻', '思明区大同路136号', 24.4485, 118.0825, '07:00-22:00', '土笋冻')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('好清香烧肉粽', '思明区中山路353号', 24.4461, 118.0831, '06:00-21:00', '烧肉粽')">
                        <div class="food-header">
                            <div class="food-name">烧肉粽</div>
                            <div class="food-price">12-20元</div>
                        </div>
                        <div class="food-description">
                            厦门传统美食，糯米包裹着香菇、虾米、栗子、五花肉等丰富馅料，用竹叶包成，香糯可口。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：好清香烧肉粽</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区中山路353号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：06:00-21:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('好清香烧肉粽', '思明区中山路353号', 24.4461, 118.0831, '06:00-21:00', '烧肉粽')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('局口拍档', '思明区局口街54号', 24.4472, 118.0845, '17:00-02:00', '海蛎煎')">
                        <div class="food-header">
                            <div class="food-name">海蛎煎</div>
                            <div class="food-price">18-28元</div>
                        </div>
                        <div class="food-description">
                            新鲜海蛎配上鸡蛋、地瓜粉煎制而成，外酥内嫩，海鲜味浓郁，是厦门夜市的经典美食。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：局口拍档</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区局口街54号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：17:00-02:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('局口拍档', '思明区局口街54号', 24.4472, 118.0845, '17:00-02:00', '海蛎煎')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <div class="category-section" id="seafood">
                <h2 class="category-title">🦐 新鲜海鲜</h2>
                <div class="food-grid">
                    <div class="food-card" onclick="showMap('小眼镜大排档', '思明区民族路33号', 24.4465, 118.0838, '17:00-03:00', '白灼虾')">
                        <div class="food-header">
                            <div class="food-name">白灼虾</div>
                            <div class="food-price">68-120元</div>
                        </div>
                        <div class="food-description">
                            选用厦门本地新鲜基围虾，简单水煮保持原味，肉质鲜甜Q弹，蘸姜丝醋汁食用，体验最纯正的海鲜味道。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：小眼镜大排档</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区民族路33号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：17:00-03:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('小眼镜大排档', '思明区民族路33号', 24.4465, 118.0838, '17:00-03:00', '白灼虾')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('海港海鲜城', '思明区环岛南路1588号', 24.4325, 118.1125, '11:00-14:00, 17:00-22:00', '清蒸石斑鱼')">
                        <div class="food-header">
                            <div class="food-name">清蒸石斑鱼</div>
                            <div class="food-price">150-300元</div>
                        </div>
                        <div class="food-description">
                            选用野生石斑鱼，清蒸保持鱼肉的鲜美，肉质细嫩，营养丰富，是厦门海鲜的代表菜品。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：海港海鲜城</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区环岛南路1588号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：11:00-14:00, 17:00-22:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('海港海鲜城', '思明区环岛南路1588号', 24.4325, 118.1125, '11:00-14:00, 17:00-22:00', '清蒸石斑鱼')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('阿德海鲜大排档', '湖里区塘边社区', 24.5125, 118.0985, '16:00-02:00', '炒花蛤')">
                        <div class="food-header">
                            <div class="food-name">炒花蛤</div>
                            <div class="food-price">25-45元</div>
                        </div>
                        <div class="food-description">
                            厦门海边特产花蛤，用九层塔爆炒，香味浓郁，肉质鲜美，是下酒的绝佳小菜。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：阿德海鲜大排档</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>湖里区塘边社区</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：16:00-02:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('阿德海鲜大排档', '湖里区塘边社区', 24.5125, 118.0985, '16:00-02:00', '炒花蛤')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <div class="category-section" id="desserts">
                <h2 class="category-title">🧁 特色甜品</h2>
                <div class="food-grid">
                    <div class="food-card" onclick="showMap('黄则和花生汤', '思明区中山路22号', 24.4468, 118.0828, '08:00-23:00', '花生汤')">
                        <div class="food-header">
                            <div class="food-name">花生汤</div>
                            <div class="food-price">8-15元</div>
                        </div>
                        <div class="food-description">
                            厦门传统甜品，花生煮得软烂香甜，汤汁浓郁，温润滋补，是厦门人从小喝到大的经典甜品。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：黄则和花生汤</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区中山路22号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：08:00-23:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('黄则和花生汤', '思明区中山路22号', 24.4468, 118.0828, '08:00-23:00', '花生汤')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('南普陀寺素饼店', '思明区思明南路515号南普陀寺内', 24.4385, 118.0965, '06:00-18:00', '南普陀素饼')">
                        <div class="food-header">
                            <div class="food-name">南普陀素饼</div>
                            <div class="food-price">30-50元/盒</div>
                        </div>
                        <div class="food-description">
                            南普陀寺特产，纯素制作，有绿豆、红豆等多种口味，酥脆香甜，是厦门著名的伴手礼。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：南普陀寺素饼店</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区思明南路515号南普陀寺内</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：06:00-18:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('南普陀寺素饼店', '思明区思明南路515号南普陀寺内', 24.4385, 118.0965, '06:00-18:00', '南普陀素饼')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('老厦门芋包', '思明区开元路78号', 24.4455, 118.0842, '07:00-19:00', '芋包')">
                        <div class="food-header">
                            <div class="food-name">芋包</div>
                            <div class="food-price">6-12元</div>
                        </div>
                        <div class="food-description">
                            用槟榔芋制作的外皮，包裹着虾仁、猪肉、笋丝等馅料，口感软糯，是厦门传统的茶点小食。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：老厦门芋包</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区开元路78号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：07:00-19:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('老厦门芋包', '思明区开元路78号', 24.4455, 118.0842, '07:00-19:00', '芋包')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <div class="category-section" id="hotpot">
                <h2 class="category-title">🍲 火锅烧烤</h2>
                <div class="food-grid">
                    <div class="food-card" onclick="showMap('海底捞火锅', '思明区嘉禾路319号', 24.4892, 118.1156, '10:00-02:00', '海底捞火锅')">
                        <div class="food-header">
                            <div class="food-name">海底捞火锅</div>
                            <div class="food-price">80-150元/人</div>
                        </div>
                        <div class="food-description">
                            知名连锁火锅品牌，服务贴心周到，锅底丰富，食材新鲜，特色毛肚、虾滑等深受喜爱。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：海底捞火锅</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区嘉禾路319号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：10:00-02:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('海底捞火锅', '思明区嘉禾路319号', 24.4892, 118.1156, '10:00-02:00', '海底捞火锅')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('老厦门烧烤', '湖里区仙岳路468号', 24.5023, 118.1089, '17:00-03:00', '厦门烧烤')">
                        <div class="food-header">
                            <div class="food-name">厦门烧烤</div>
                            <div class="food-price">50-100元/人</div>
                        </div>
                        <div class="food-description">
                            地道的闽南烧烤，海鲜烧烤是特色，烤生蚝、烤扇贝、烤鱿鱼，配上冰啤酒，夜宵首选。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：老厦门烧烤</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>湖里区仙岳路468号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：17:00-03:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('老厦门烧烤', '湖里区仙岳路468号', 24.5023, 118.1089, '17:00-03:00', '厦门烧烤')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('潮汕牛肉火锅', '思明区湖滨南路76号', 24.4756, 118.0923, '11:00-23:00', '潮汕牛肉火锅')">
                        <div class="food-header">
                            <div class="food-name">潮汕牛肉火锅</div>
                            <div class="food-price">60-120元/人</div>
                        </div>
                        <div class="food-description">
                            正宗潮汕风味，清汤锅底，新鲜牛肉现切现涮，牛肉丸、牛筋丸Q弹爽口，蘸料丰富。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：潮汕牛肉火锅</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区湖滨南路76号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：11:00-23:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('潮汕牛肉火锅', '思明区湖滨南路76号', 24.4756, 118.0923, '11:00-23:00', '潮汕牛肉火锅')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <div class="category-section" id="noodles">
                <h2 class="category-title">� 面食粥品</h2>
                <div class="food-grid">
                    <div class="food-card" onclick="showMap('阿芬面线糊', '思明区民族路28号', 24.4471, 118.0834, '06:00-14:00', '面线糊')">
                        <div class="food-header">
                            <div class="food-name">面线糊</div>
                            <div class="food-price">8-15元</div>
                        </div>
                        <div class="food-description">
                            厦门传统早餐，细面线煮成糊状，加入虾仁、蚵仔、猪血、韭菜等配料，口感顺滑，营养丰富。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：阿芬面线糊</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区民族路28号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：06:00-14:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('阿芬面线糊', '思明区民族路28号', 24.4471, 118.0834, '06:00-14:00', '面线糊')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('老字号扁食', '思明区开元路156号', 24.4458, 118.0845, '07:00-21:00', '扁食')">
                        <div class="food-header">
                            <div class="food-name">扁食</div>
                            <div class="food-price">12-20元</div>
                        </div>
                        <div class="food-description">
                            闽南特色小食，类似馄饨但皮更薄，馅料丰富，汤清味鲜，是厦门人喜爱的传统美食。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：老字号扁食</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区开元路156号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：07:00-21:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('老字号扁食', '思明区开元路156号', 24.4458, 118.0845, '07:00-21:00', '扁食')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('传统白粥配菜', '思明区大同路88号', 24.4475, 118.0829, '06:30-22:00', '白粥小菜')">
                        <div class="food-header">
                            <div class="food-name">白粥小菜</div>
                            <div class="food-price">15-25元</div>
                        </div>
                        <div class="food-description">
                            经典闽南早餐搭配，香滑白粥配上咸菜、肉松、咸鸭蛋、花生米等小菜，简单却美味。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：传统白粥配菜</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区大同路88号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：06:30-22:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('传统白粥配菜', '思明区大同路88号', 24.4475, 118.0829, '06:30-22:00', '白粥小菜')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <div class="category-section" id="drinks">
                <h2 class="category-title">🧋 饮品茶点</h2>
                <div class="food-grid">
                    <div class="food-card" onclick="showMap('一点点奶茶', '思明区中山路步行街', 24.4465, 118.0831, '09:00-23:00', '奶茶')">
                        <div class="food-header">
                            <div class="food-name">奶茶</div>
                            <div class="food-price">15-25元</div>
                        </div>
                        <div class="food-description">
                            台式奶茶连锁品牌，口感丰富，珍珠Q弹，奶香浓郁，是年轻人喜爱的时尚饮品。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：一点点奶茶</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区中山路步行街</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：09:00-23:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('一点点奶茶', '思明区中山路步行街', 24.4465, 118.0831, '09:00-23:00', '奶茶')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('老厦门茶庄', '思明区思明南路298号', 24.4398, 118.0952, '08:00-20:00', '功夫茶')">
                        <div class="food-header">
                            <div class="food-name">功夫茶</div>
                            <div class="food-price">30-80元/壶</div>
                        </div>
                        <div class="food-description">
                            正宗闽南功夫茶，铁观音、大红袍等名茶，传统茶艺表演，体验闽南茶文化的精髓。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：老厦门茶庄</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区思明南路298号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：08:00-20:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('老厦门茶庄', '思明区思明南路298号', 24.4398, 118.0952, '08:00-20:00', '功夫茶')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('鲜榨果汁店', '思明区曾厝垵文创村', 24.4289, 118.0876, '10:00-22:00', '鲜榨果汁')">
                        <div class="food-header">
                            <div class="food-name">鲜榨果汁</div>
                            <div class="food-price">18-35元</div>
                        </div>
                        <div class="food-description">
                            新鲜水果现榨，芒果汁、西瓜汁、百香果汁等，无添加剂，健康美味，夏日解暑佳品。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：鲜榨果汁店</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区曾厝垵文创村</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：10:00-22:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('鲜榨果汁店', '思明区曾厝垵文创村', 24.4289, 118.0876, '10:00-22:00', '鲜榨果汁')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <div class="category-section" id="western">
                <h2 class="category-title">🍕 西式料理</h2>
                <div class="food-grid">
                    <div class="food-card" onclick="showMap('必胜客', '思明区湖滨中路99号', 24.4723, 118.0912, '10:00-22:00', '披萨')">
                        <div class="food-header">
                            <div class="food-name">披萨</div>
                            <div class="food-price">60-150元</div>
                        </div>
                        <div class="food-description">
                            经典意式披萨，芝士拉丝，配料丰富，玛格丽特、夏威夷、海鲜等多种口味可选。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：必胜客</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区湖滨中路99号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：10:00-22:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('必胜客', '思明区湖滨中路99号', 24.4723, 118.0912, '10:00-22:00', '披萨')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('牛排世家', '思明区嘉禾路188号', 24.4856, 118.1134, '11:00-23:00', '牛排')">
                        <div class="food-header">
                            <div class="food-name">牛排</div>
                            <div class="food-price">80-200元</div>
                        </div>
                        <div class="food-description">
                            精选优质牛肉，专业烹饪，三分熟到全熟可选，配土豆泥、蔬菜沙拉，西式正餐体验。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：牛排世家</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区嘉禾路188号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：11:00-23:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('牛排世家', '思明区嘉禾路188号', 24.4856, 118.1134, '11:00-23:00', '牛排')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('星巴克咖啡', '思明区中山路175号', 24.4462, 118.0835, '07:00-22:00', '咖啡')">
                        <div class="food-header">
                            <div class="food-name">咖啡</div>
                            <div class="food-price">25-45元</div>
                        </div>
                        <div class="food-description">
                            全球知名咖啡连锁，拿铁、卡布奇诺、美式咖啡等经典饮品，配精美糕点，休闲好去处。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：星巴克咖啡</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区中山路175号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：07:00-22:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('星巴克咖啡', '思明区中山路175号', 24.4462, 118.0835, '07:00-22:00', '咖啡')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <div class="category-section" id="specialty">
                <h2 class="category-title">🥘 特色菜系</h2>
                <div class="food-grid">
                    <div class="food-card" onclick="showMap('川味观', '思明区禾祥西路126号', 24.4689, 118.0945, '11:00-22:00', '川菜')">
                        <div class="food-header">
                            <div class="food-name">川菜</div>
                            <div class="food-price">40-80元/人</div>
                        </div>
                        <div class="food-description">
                            正宗四川风味，麻婆豆腐、宫保鸡丁、水煮鱼等经典川菜，麻辣鲜香，口味地道。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：川味观</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区禾祥西路126号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：11:00-22:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('川味观', '思明区禾祥西路126号', 24.4689, 118.0945, '11:00-22:00', '川菜')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('粤港茶餐厅', '思明区湖滨北路108号', 24.4798, 118.0934, '07:00-23:00', '粤菜')">
                        <div class="food-header">
                            <div class="food-name">粤菜</div>
                            <div class="food-price">50-120元/人</div>
                        </div>
                        <div class="food-description">
                            广东风味菜系，白切鸡、蒸排骨、虾饺、烧卖等经典粤菜和点心，清淡鲜美。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：粤港茶餐厅</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>思明区湖滨北路108号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：07:00-23:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('粤港茶餐厅', '思明区湖滨北路108号', 24.4798, 118.0934, '07:00-23:00', '粤菜')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>

                    <div class="food-card" onclick="showMap('东北饺子馆', '湖里区长岭路89号', 24.5156, 118.1023, '10:00-21:00', '东北菜')">
                        <div class="food-header">
                            <div class="food-name">东北菜</div>
                            <div class="food-price">35-70元/人</div>
                        </div>
                        <div class="food-description">
                            东北家常菜，锅包肉、地三鲜、东北饺子等，分量足，口味重，实惠美味。
                        </div>
                        <div class="restaurant-info">
                            <div class="restaurant-name">📍 推荐店铺：东北饺子馆</div>
                            <div class="detail-item">
                                <span class="detail-icon">📍</span>
                                <span>湖里区长岭路89号</span>
                            </div>
                            <div class="opening-hours">
                                ⏰ 营业时间：10:00-21:00
                            </div>
                            <button class="location-btn" onclick="event.stopPropagation(); showMap('东北饺子馆', '湖里区长岭路89号', 24.5156, 118.1023, '10:00-21:00', '东北菜')">
                                📍 查看位置
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="food-tips" id="tips">
            <h2 class="tips-title">�🍽️ 厦门美食攻略</h2>
            <div class="tips-grid">
                <div class="tip-card">
                    <h4>🗺️ 美食街推荐</h4>
                    <ul class="tip-list">
                        <li>中山路步行街：传统小吃聚集地</li>
                        <li>八市：本地人的菜市场美食</li>
                        <li>曾厝垵：文艺小吃一条街</li>
                        <li>局口街：深夜食堂的好去处</li>
                    </ul>
                </div>

                <div class="tip-card">
                    <h4>⏰ 最佳用餐时间</h4>
                    <ul class="tip-list">
                        <li>早餐：7:00-9:00，体验厦门早茶文化</li>
                        <li>午餐：11:30-13:30，避开用餐高峰</li>
                        <li>下午茶：15:00-17:00，品尝甜品小食</li>
                        <li>夜宵：20:00-02:00，感受夜市风情</li>
                    </ul>
                </div>

                <div class="tip-card">
                    <h4>💰 消费指南</h4>
                    <ul class="tip-list">
                        <li>街边小吃：人均20-40元</li>
                        <li>普通餐厅：人均50-100元</li>
                        <li>海鲜大排档：人均100-200元</li>
                        <li>高档餐厅：人均200-500元</li>
                    </ul>
                </div>

                <div class="tip-card">
                    <h4>🎯 美食体验建议</h4>
                    <ul class="tip-list">
                        <li>尝试当地特色，不要只吃熟悉的菜</li>
                        <li>选择人多的店铺，通常味道更正宗</li>
                        <li>海鲜要选择新鲜的，看眼睛是否明亮</li>
                        <li>带好肠胃药，适应当地口味需要时间</li>
                    </ul>
                </div>
            </div>
        </div>

        <div style="text-align: center;">
            <a href="index.html" class="back-button">← 返回首页</a>
        </div>
    </div>

    <!-- 地图弹窗 -->
    <div id="mapModal" class="map-modal">
        <div class="map-modal-content">
            <div class="map-header">
                <div class="map-title">
                    <span>📍</span>
                    <span id="modalTitle">店铺位置</span>
                </div>
                <button class="close-btn" onclick="closeMap()">&times;</button>
            </div>
            <div class="map-container">
                <div id="mapContainer" style="width: 100%; height: 100%;"></div>
            </div>
            <div class="map-footer">
                <div class="restaurant-details">
                    <h4 id="restaurantName">店铺名称</h4>
                    <p id="restaurantAddress">店铺地址</p>
                    <p id="restaurantHours">营业时间</p>
                </div>
                <button class="navigation-btn" onclick="startNavigation()">
                    🧭 开始导航
                </button>
            </div>
        </div>
    </div>

    <!-- 腾讯地图API -->
    <script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=4ETBZ-QOSWL-NZHPN-E7QOL-LNWGQ-T4F6G&callback=initTMapAPI"></script>
    
    <script>
        let map;
        let currentRestaurant = {};
        let userLocation = null;
        let tmapReady = false;

        // 腾讯地图API加载完成回调
        window.initTMapAPI = function() {
            console.log('腾讯地图API加载成功');
            tmapReady = true;
            // 如果有等待显示的地图，立即初始化
            if (window.pendingMapData) {
                const data = window.pendingMapData;
                initMap(data.lat, data.lng, data.name);
                window.pendingMapData = null;
            }
        };

        function showMap(name, address, lat, lng, hours, foodName) {
            console.log('显示地图:', name, address, lat, lng);
            
            currentRestaurant = {
                name: name,
                address: address,
                lat: lat,
                lng: lng,
                hours: hours,
                foodName: foodName
            };

            // 更新弹窗信息
            document.getElementById('modalTitle').textContent = `${foodName} - ${name}`;
            document.getElementById('restaurantName').textContent = name;
            document.getElementById('restaurantAddress').textContent = address;
            document.getElementById('restaurantHours').textContent = `营业时间：${hours}`;

            // 显示弹窗
            const modal = document.getElementById('mapModal');
            modal.style.display = 'block';
            console.log('弹窗已显示');

            // 显示加载状态
            showMapLoading();

            // 检查API是否已加载
            if (tmapReady && typeof TMap !== 'undefined') {
                setTimeout(() => {
                    initMap(lat, lng, name);
                }, 300);
            } else {
                // 保存数据等待API加载
                window.pendingMapData = { lat, lng, name };
                
                // 检查API加载状态
                let retryCount = 0;
                const checkInterval = setInterval(() => {
                    retryCount++;
                    console.log(`检查腾讯地图API状态 - 第${retryCount}次`);
                    
                    if (typeof TMap !== 'undefined') {
                        tmapReady = true;
                        clearInterval(checkInterval);
                        console.log('腾讯地图API检测到，开始初始化地图');
                        initMap(lat, lng, name);
                    } else if (retryCount > 20) { // 10秒后超时
                        clearInterval(checkInterval);
                        console.log('腾讯地图API加载超时，显示备用方案');
                        showMapFallback();
                    }
                }, 500);
            }
        }

        function showMapLoading() {
            document.getElementById('mapContainer').innerHTML = `
                <div style="
                    display: flex; 
                    flex-direction: column; 
                    align-items: center; 
                    justify-content: center; 
                    height: 100%; 
                    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                    color: white;
                    text-align: center;
                    border-radius: 10px;
                ">
                    <div style="
                        width: 60px;
                        height: 60px;
                        border: 4px solid rgba(255,255,255,0.3);
                        border-top: 4px solid white;
                        border-radius: 50%;
                        animation: spin 1s linear infinite;
                        margin-bottom: 20px;
                    "></div>
                    <div style="font-size: 18px; margin-bottom: 10px;">🗺️ 正在加载地图...</div>
                    <div style="font-size: 14px; opacity: 0.8;">正在定位 ${currentRestaurant.name}</div>
                    <div style="font-size: 12px; opacity: 0.6; margin-top: 10px;">
                        坐标: ${currentRestaurant.lat}, ${currentRestaurant.lng}
                    </div>
                </div>
                <style>
                    @keyframes spin {
                        0% { transform: rotate(0deg); }
                        100% { transform: rotate(360deg); }
                    }
                </style>
            `;
        }

        function showMapFallback() {
            document.getElementById('mapContainer').innerHTML = `
                <div style="
                    width: 100%; 
                    height: 100%; 
                    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    border-radius: 10px;
                    position: relative;
                    overflow: hidden;
                ">
                    <div style="
                        text-align: center;
                        color: white;
                        background: rgba(0,0,0,0.2);
                        padding: 30px;
                        border-radius: 15px;
                        backdrop-filter: blur(10px);
                        border: 1px solid rgba(255,255,255,0.2);
                        position: relative;
                        z-index: 1;
                    ">
                        <div style="font-size: 48px; margin-bottom: 15px;">📍</div>
                        <h3 style="margin: 0 0 15px 0; font-size: 20px; font-weight: bold;">${currentRestaurant.name}</h3>
                        <p style="margin: 8px 0; font-size: 14px; opacity: 0.9; line-height: 1.4;">
                            <span style="color: #ffd700;">📍</span> ${currentRestaurant.address}
                        </p>
                        <p style="margin: 8px 0; font-size: 13px; opacity: 0.8; background: rgba(255,255,255,0.1); padding: 8px 12px; border-radius: 20px;">
                            <span style="color: #ffd700;">⏰</span> ${currentRestaurant.hours}
                        </p>
                        <div style="margin: 15px 0; padding: 10px; background: rgba(255,255,255,0.1); border-radius: 10px; font-size: 12px;">
                            <div style="margin-bottom: 5px; opacity: 0.8;">精确坐标位置:</div>
                            <div style="font-family: monospace; font-weight: bold;">
                                纬度: ${currentRestaurant.lat}<br>
                                经度: ${currentRestaurant.lng}
                            </div>
                        </div>
                        <button onclick="openExternalMap()" style="
                            background: linear-gradient(135deg, #ff6b6b, #ee5a52);
                            color: white;
                            border: none;
                            padding: 12px 24px;
                            border-radius: 25px;
                            cursor: pointer;
                            font-size: 14px;
                            font-weight: bold;
                            box-shadow: 0 4px 15px rgba(255,107,107,0.3);
                            transition: all 0.3s ease;
                        " onmouseover="this.style.transform='translateY(-2px)'" onmouseout="this.style.transform='translateY(0)'">
                            🗺️ 在外部地图中查看
                        </button>
                    </div>
                </div>
            `;
        }

        function showMapError() {
            showMapFallback();
        }

        function openExternalMap() {
            const lat = currentRestaurant.lat;
            const lng = currentRestaurant.lng;
            const name = currentRestaurant.name;
            
            // 构建腾讯地图URL
            const mapUrl = `https://apis.map.qq.com/uri/v1/marker?marker=coord:${lat},${lng};title:${encodeURIComponent(name)}&referer=xiamen-food`;
            
            console.log('打开外部地图:', mapUrl);
            window.open(mapUrl, '_blank');
        }

        function initMap(lat, lng, name) {
            console.log('开始初始化腾讯地图:', lat, lng, name);
            
            // 如果地图已存在，先销毁
            if (map) {
                try {
                    map.destroy();
                    console.log('旧地图已销毁');
                } catch (error) {
                    console.log('销毁旧地图时出错:', error);
                }
                map = null;
            }

            try {
                // 清空容器
                const mapContainer = document.getElementById('mapContainer');
                mapContainer.innerHTML = '';

                // 创建地图实例
                map = new TMap.Map('mapContainer', {
                    center: new TMap.LatLng(lat, lng),
                    zoom: 17,
                    mapTypeId: TMap.MapTypeId.ROADMAP,
                    pitch: 0,
                    rotation: 0
                });

                console.log('腾讯地图实例创建成功');

                // 创建自定义标记样式
                const markerStyle = new TMap.MarkerStyle({
                    'width': 32,
                    'height': 44,
                    'anchor': { x: 16, y: 44 },
                    'src': `data:image/svg+xml;base64,${btoa(`
                        <svg width="32" height="44" viewBox="0 0 32 44" xmlns="http://www.w3.org/2000/svg">
                            <defs>
                                <linearGradient id="grad" x1="0%" y1="0%" x2="0%" y2="100%">
                                    <stop offset="0%" style="stop-color:#ff6b6b;stop-opacity:1" />
                                    <stop offset="100%" style="stop-color:#ee5a52;stop-opacity:1" />
                                </linearGradient>
                            </defs>
                            <path d="M16 0C7.2 0 0 7.2 0 16c0 16 16 28 16 28s16-12 16-28C32 7.2 24.8 0 16 0z" fill="url(#grad)" stroke="#fff" stroke-width="2"/>
                            <circle cx="16" cy="16" r="6" fill="#fff"/>
                            <text x="16" y="20" text-anchor="middle" font-size="8" fill="#ff6b6b" font-weight="bold">店</text>
                        </svg>
                    `)}`
                });

                // 添加标记
                const marker = new TMap.MultiMarker({
                    map: map,
                    styles: {
                        'restaurant': markerStyle
                    },
                    geometries: [{
                        id: 'restaurant',
                        styleId: 'restaurant',
                        position: new TMap.LatLng(lat, lng),
                        properties: {
                            title: name
                        }
                    }]
                });

                console.log('地图标记添加成功');

                // 创建信息窗口
                const infoWindow = new TMap.InfoWindow({
                    map: map,
                    position: new TMap.LatLng(lat, lng),
                    content: `
                        <div style="
                            padding: 15px; 
                            text-align: center; 
                            min-width: 200px; 
                            font-family: 'Microsoft YaHei', sans-serif;
                            background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
                            border-radius: 8px;
                            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
                        ">
                            <div style="
                                display: flex; 
                                align-items: center; 
                                justify-content: center; 
                                margin-bottom: 10px;
                            ">
                                <span style="font-size: 20px; margin-right: 8px;">🍜</span>
                                <h4 style="margin: 0; color: #ff6b6b; font-size: 16px; font-weight: bold;">${name}</h4>
                            </div>
                            <p style="margin: 8px 0; font-size: 13px; color: #666; line-height: 1.4;">
                                <span style="color: #ff6b6b;">📍</span> ${currentRestaurant.address}
                            </p>
                            <p style="margin: 8px 0; font-size: 12px; color: #999; background: #f0f8ff; padding: 6px 10px; border-radius: 15px;">
                                <span style="color: #ff6b6b;">⏰</span> ${currentRestaurant.hours}
                            </p>
                            <div style="margin-top: 10px; font-size: 11px; color: #999; border-top: 1px solid #eee; padding-top: 8px;">
                                精确坐标: ${lat}, ${lng}
                            </div>
                        </div>
                    `,
                    offset: { x: 0, y: -44 }
                });

                console.log('信息窗口创建成功');

                // 监听地图加载完成事件
                map.on('tilesloaded', function() {
                    console.log('地图瓦片加载完成');
                });

                // 监听标记点击事件
                marker.on('click', function(evt) {
                    console.log('标记被点击');
                    infoWindow.open();
                });

                // 默认显示信息窗口
                setTimeout(() => {
                    infoWindow.open();
                }, 500);

                // 添加缩放控件
                const zoomControl = new TMap.Control.Zoom({
                    map: map,
                    position: TMap.constants.CONTROL_POSITION.BOTTOM_RIGHT
                });

                console.log('地图初始化完全成功');

            } catch (error) {
                console.error('初始化地图失败:', error);
                showMapFallback();
            }
        }

        function closeMap() {
            // 销毁地图实例
            if (map) {
                try {
                    map.destroy();
                    console.log('地图已销毁');
                } catch (error) {
                    console.log('销毁地图时出错:', error);
                }
                map = null;
            }
            document.getElementById('mapModal').style.display = 'none';
        }

        function startNavigation() {
            console.log('开始导航功能');
            
            // 检查是否有目标位置信息
            if (!currentRestaurant.lat || !currentRestaurant.lng) {
                alert('目标位置信息不完整，无法启动导航');
                return;
            }

            // 显示导航准备状态
            const navBtn = document.querySelector('.navigation-btn');
            const originalText = navBtn.innerHTML;
            navBtn.innerHTML = '🔍 正在定位...';
            navBtn.disabled = true;

            // 获取用户当前位置
            if (navigator.geolocation) {
                console.log('开始获取用户位置...');
                
                navigator.geolocation.getCurrentPosition(
                    function(position) {
                        // 成功获取位置
                        const userLat = position.coords.latitude;
                        const userLng = position.coords.longitude;
                        
                        console.log('用户位置获取成功:', userLat, userLng);
                        console.log('目标位置:', currentRestaurant.lat, currentRestaurant.lng);
                        
                        // 更新全局用户位置
                        userLocation = {
                            lat: userLat,
                            lng: userLng
                        };

                        // 恢复按钮状态
                        navBtn.innerHTML = originalText;
                        navBtn.disabled = false;

                        // 启动腾讯地图导航
                        launchTencentNavigation(userLat, userLng, currentRestaurant.lat, currentRestaurant.lng);
                    },
                    function(error) {
                        console.error('获取位置失败:', error);
                        
                        // 恢复按钮状态
                        navBtn.innerHTML = originalText;
                        navBtn.disabled = false;

                        // 根据错误类型提供不同的处理方案
                        switch(error.code) {
                            case error.PERMISSION_DENIED:
                                handleLocationPermissionDenied();
                                break;
                            case error.POSITION_UNAVAILABLE:
                                handleLocationUnavailable();
                                break;
                            case error.TIMEOUT:
                                handleLocationTimeout();
                                break;
                            default:
                                handleLocationUnknownError();
                                break;
                        }
                    },
                    {
                        enableHighAccuracy: true,  // 启用高精度定位
                        timeout: 10000,           // 10秒超时
                        maximumAge: 300000        // 5分钟内的缓存位置可用
                    }
                );
            } else {
                console.log('浏览器不支持地理定位');
                navBtn.innerHTML = originalText;
                navBtn.disabled = false;
                handleGeolocationNotSupported();
            }
        }

        // 启动腾讯地图导航
        function launchTencentNavigation(fromLat, fromLng, toLat, toLng) {
            try {
                // 构建腾讯地图导航URL
                const navUrl = `https://apis.map.qq.com/uri/v1/routeplan?` +
                    `type=drive&` +
                    `from=${fromLat},${fromLng}&` +
                    `fromname=${encodeURIComponent('我的位置')}&` +
                    `to=${toLat},${toLng}&` +
                    `toname=${encodeURIComponent(currentRestaurant.name)}&` +
                    `policy=1&` +
                    `referer=xiamen-food`;
                
                console.log('导航URL:', navUrl);
                console.log(`导航路线: (${fromLat}, ${fromLng}) -> (${toLat}, ${toLng})`);
                
                // 显示导航确认信息
                const distance = calculateDistance(fromLat, fromLng, toLat, toLng);
                const confirmMessage = `🧭 即将为您导航到：\n\n` +
                    `📍 目的地：${currentRestaurant.name}\n` +
                    `📍 地址：${currentRestaurant.address}\n` +
                    `📏 预估距离：${distance}公里\n` +
                    `⏰ 营业时间：${currentRestaurant.hours}\n\n` +
                    `确定要在腾讯地图中打开导航吗？`;
                
                if (confirm(confirmMessage)) {
                    // 打开腾讯地图导航
                    window.open(navUrl, '_blank');
                    
                    // 显示成功提示
                    showNavigationSuccess();
                }
                
            } catch (error) {
                console.error('启动导航失败:', error);
                alert(`导航启动失败：${error.message}\n\n` +
                      `目标信息：\n` +
                      `店铺：${currentRestaurant.name}\n` +
                      `地址：${currentRestaurant.address}\n` +
                      `坐标：${currentRestaurant.lat}, ${currentRestaurant.lng}`);
            }
        }

        // 计算两点间距离（简化版本，单位：公里）
        function calculateDistance(lat1, lng1, lat2, lng2) {
            const R = 6371; // 地球半径（公里）
            const dLat = (lat2 - lat1) * Math.PI / 180;
            const dLng = (lng2 - lng1) * Math.PI / 180;
            const a = Math.sin(dLat/2) * Math.sin(dLat/2) +
                      Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) *
                      Math.sin(dLng/2) * Math.sin(dLng/2);
            const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
            const distance = R * c;
            return distance.toFixed(1);
        }

        // 处理位置权限被拒绝
        function handleLocationPermissionDenied() {
            const message = `❌ 位置权限被拒绝\n\n` +
                `为了提供精准导航，需要获取您的位置信息。\n\n` +
                `请按以下步骤操作：\n` +
                `1. 点击地址栏左侧的🔒图标\n` +
                `2. 允许位置访问权限\n` +
                `3. 刷新页面后重试\n\n` +
                `或者您可以手动输入起点进行导航。`;
            
            if (confirm(message + '\n\n是否使用手动导航？')) {
                launchManualNavigation();
            }
        }

        // 处理位置不可用
        function handleLocationUnavailable() {
            const message = `📍 无法获取位置信息\n\n` +
                `可能的原因：\n` +
                `• GPS信号较弱\n` +
                `• 网络连接问题\n` +
                `• 设备定位服务未开启\n\n` +
                `建议：\n` +
                `• 移动到空旷区域\n` +
                `• 检查网络连接\n` +
                `• 开启设备定位服务`;
            
            if (confirm(message + '\n\n是否使用手动导航？')) {
                launchManualNavigation();
            }
        }

        // 处理定位超时
        function handleLocationTimeout() {
            const message = `⏰ 定位超时\n\n` +
                `获取位置信息耗时过长，可能是：\n` +
                `• 网络信号不稳定\n` +
                `• GPS信号较弱\n\n` +
                `建议重试或使用手动导航。`;
            
            if (confirm(message + '\n\n是否重试定位？')) {
                startNavigation(); // 重试
            } else if (confirm('是否使用手动导航？')) {
                launchManualNavigation();
            }
        }

        // 处理未知定位错误
        function handleLocationUnknownError() {
            const message = `❓ 定位出现未知错误\n\n` +
                `请尝试：\n` +
                `• 刷新页面重试\n` +
                `• 检查浏览器设置\n` +
                `• 使用手动导航`;
            
            if (confirm(message + '\n\n是否使用手动导航？')) {
                launchManualNavigation();
            }
        }

        // 处理不支持地理定位
        function handleGeolocationNotSupported() {
            const message = `🚫 浏览器不支持定位功能\n\n` +
                `建议：\n` +
                `• 更新浏览器到最新版本\n` +
                `• 使用现代浏览器（Chrome、Firefox、Safari等）\n` +
                `• 使用手动导航功能`;
            
            if (confirm(message + '\n\n是否使用手动导航？')) {
                launchManualNavigation();
            }
        }

        // 手动导航（不需要用户位置）
        function launchManualNavigation() {
            try {
                // 构建只有目的地的导航URL
                const navUrl = `https://apis.map.qq.com/uri/v1/marker?` +
                    `marker=coord:${currentRestaurant.lat},${currentRestaurant.lng};` +
                    `title:${encodeURIComponent(currentRestaurant.name)}&` +
                    `referer=xiamen-food`;
                
                console.log('手动导航URL:', navUrl);
                
                const message = `🗺️ 即将在腾讯地图中显示目的地\n\n` +
                    `📍 ${currentRestaurant.name}\n` +
                    `📍 ${currentRestaurant.address}\n\n` +
                    `您可以在地图中手动设置起点进行导航。`;
                
                alert(message);
                window.open(navUrl, '_blank');
                
            } catch (error) {
                console.error('手动导航失败:', error);
                alert('导航功能暂时不可用，请稍后重试。');
            }
        }

        // 显示导航成功提示
        function showNavigationSuccess() {
            // 创建成功提示元素
            const successDiv = document.createElement('div');
            successDiv.style.cssText = `
                position: fixed;
                top: 20px;
                right: 20px;
                background: linear-gradient(135deg, #4CAF50, #45a049);
                color: white;
                padding: 15px 20px;
                border-radius: 10px;
                box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
                z-index: 10000;
                font-size: 14px;
                font-weight: bold;
                animation: slideInRight 0.3s ease-out;
            `;
            successDiv.innerHTML = `
                <div style="display: flex; align-items: center; gap: 10px;">
                    <span style="font-size: 18px;">✅</span>
                    <span>导航已启动！正在跳转到腾讯地图...</span>
                </div>
            `;
            
            // 添加动画样式
            const style = document.createElement('style');
            style.textContent = `
                @keyframes slideInRight {
                    from {
                        opacity: 0;
                        transform: translateX(100px);
                    }
                    to {
                        opacity: 1;
                        transform: translateX(0);
                    }
                }
            `;
            document.head.appendChild(style);
            
            document.body.appendChild(successDiv);
            
            // 3秒后自动移除提示
            setTimeout(() => {
                if (successDiv.parentNode) {
                    successDiv.remove();
                }
                if (style.parentNode) {
                    style.remove();
                }
            }, 3000);
        }

        // 改进的获取用户位置函数
        function getUserLocation() {
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(
                    function(position) {
                        userLocation = {
                            lat: position.coords.latitude,
                            lng: position.coords.longitude
                        };
                        console.log('用户位置获取成功:', userLocation);
                    },
                    function(error) {
                        console.log('获取位置失败:', error);
                        // 默认设置为厦门市中心
                        userLocation = {
                            lat: 24.4797,
                            lng: 118.0819
                        };
                    },
                    {
                        enableHighAccuracy: true,
                        timeout: 5000,
                        maximumAge: 300000
                    }
                );
            } else {
                console.log('浏览器不支持地理定位');
                userLocation = {
                    lat: 24.4797,
                    lng: 118.0819
                };
            }
        }

        // 页面加载时获取用户位置
        document.addEventListener('DOMContentLoaded', function() {
            getUserLocation();
            console.log('页面加载完成，地图功能已初始化');
        });

        // 点击弹窗外部关闭
        window.onclick = function(event) {
            const modal = document.getElementById('mapModal');
            if (event.target === modal) {
                closeMap();
            }
        }

        // 测试函数 - 可以在控制台调用
        function testMap() {
            showMap('四里沙茶面', '思明区大同路49号', 24.4478, 118.0832, '06:30-14:00, 17:00-02:00', '沙茶面');
        }
    </script>
</body>






